package com.dapeis.core.utils.json;

import java.lang.reflect.Type;

import com.dapeis.core.utils.DBConfigUtils;
import com.dapeis.core.utils.StylistConstants;
import com.dapeis.domain.Shop;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class ShopGsonAdapter implements JsonSerializer<Shop> {

    @Override
    public JsonElement serialize(Shop src, Type typeOfSrc,
	    JsonSerializationContext context) {
	JsonObject json = new JsonObject();
	json.addProperty("id", src.getId());
	json.addProperty("type", src.getType());
	json.addProperty("content", src.getContent());
	json.addProperty("price",DBConfigUtils.paserMoney(src.getPrice()));
	json.addProperty("num", src.getBuyNum());
	return json;
    }

}
